class Pattern extends egret.DisplayObjectContainer {
    private pattern: PokerPattern;
    private num: number;

    public constructor(pattern: PokerPattern, num: number) {
        super();
        this.pattern = pattern;
        this.num = num;
        this.width=20;
        this.height=50;
        this.onCreate();
    }

    protected onCreate(): void {
        let pattern: egret.Bitmap;
        let num: egret.Bitmap;
        switch (this.pattern) {
            case PokerPattern.HEART:
                pattern = new egret.Bitmap(RES.getRes("hongtao_png"));
                num = new egret.Bitmap(RES.getRes("2" + this.num + "_png"));
                break;
            case PokerPattern.SPADE:
                pattern = new egret.Bitmap(RES.getRes("heitao_png"));
                num = new egret.Bitmap(RES.getRes("0" + this.num + "_png"));
                break;
            case PokerPattern.DIAMOND:
                pattern = new egret.Bitmap(RES.getRes("fangpian_png"));
                num = new egret.Bitmap(RES.getRes("2" + this.num + "_png"));
                break;
            case PokerPattern.CLUB:
                pattern = new egret.Bitmap(RES.getRes("meihua_png"));
                num = new egret.Bitmap(RES.getRes("0" + this.num + "_png"));
                break;
        }

        pattern.x = 10;
        pattern.y = 35;
        num.x = 10;
        num.y = 10;

        this.addChild(pattern);
        this.addChild(num);
    }
}